package com.cskaoyan.wordmemorize.common.constant;

import lombok.Getter;

/**
 * 操作类型枚举
 */
@Getter
public enum OperateTypeEnum {

    // 后端 增加是1 修改是2 删除是3 批量删除是4 5是修改状态 6是excel导入
    // 前端 增加是1 删除是2 批量删除是3 修改是4 其他待测试
    // 不过不影响，功能实现了就行

    ADD(1, "新增"),
    UPDATE(2, "修改"),
    DELETE(3, "单个删除"),
    BATCH_DELETE(4, "批量删除"),
    UPDATE_STATUS(5, "修改状态"),
    EXCEL_IMPORT(6, "excel导入");

    private final int code;
    private final String description;

    OperateTypeEnum(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public static String getDescriptionByCode(int code) {
        for (OperateTypeEnum type : OperateTypeEnum.values()) {
            if (type.getCode() == code) {
                return type.getDescription();
            }
        }
        return "";
    }
}
